package cn.rokhdelar.ams.management.controller;

import cn.rokhdelar.ams.common.domain.vo.PageVO;
import cn.rokhdelar.ams.management.domain.query.LoginLogQuery;
import cn.rokhdelar.ams.management.domain.vo.LoginLogVO;
import cn.rokhdelar.ams.management.service.SysLoginLogService;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Rokhdelar
 * @since 2025/3/25 -- 14:34
 **/
@RestController
@RequestMapping("/management/login-logs")
@RequiredArgsConstructor
public class LoginLogController {
    private final SysLoginLogService sysLoginLogService;

    @GetMapping
    @Schema(description = "获取所有登录日志")
    public ResponseEntity<PageVO<LoginLogVO>> getLoginLogs(@ParameterObject LoginLogQuery query) {
        return ResponseEntity.ok(sysLoginLogService.getLoginLogs(query));
    }
}
